const express = require("express");
const router = express.Router();
const path = require("path");
const Sequelize = require("sequelize");
let myTable = require("../commen/mysql");

/* GET home page. */
//关注者列表
router.get("/", function (req, res, next) {
    let watcher;
    let send = async () => {
        
        let user_id = req.query.user_id;
        try {
            watchers = await myTable.relations.findAll({
                where:{
                    follower_id : user_id
                }
            });
            watchers = watchers.dataValue
            res.send({code:0,watchers:watchers})
        }
        catch (e) {
            console.log(e);
        }
    }
    send();

});
//单个关注者信息
router.get("/watcherInfo", function (req, res, next) {
    let watcherInfo;
    let send = async () => {
        
        let user_id = req.query.user_id;
        try {
            watchers = await myTable.relations.findAll({
                where:{
                    follower_id : user_id
                }
            });
            watchers = watchers.dataValue
            // res.send({code:0,watchers:watchers})
        }
        catch (e) {
            console.log(e);
        }
    }
    send();

});

module.exports = router;
